//
// Created by wze-zero on 2024/10/25.
//
#include <iostream>

using namespace std;

long long check(long long num) {
    if (num == 0) {
        return 0;
    } else if (num == 1) {
        return 1;
    } else {
        return check(num / 2) + num % 2;
    }
}

int main() {
    long long n, num, sum;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> num;
        sum = check(num);
        cout << sum << ' ' << (1ll << sum) - 1 << endl;
    }
    return 0;
}